#include "recordurlfilter.h"

#include <QFile>
#include <QTextStream>
#include <QDebug>
#include <QCoreApplication>

RecordUrlFilter::RecordUrlFilter()
{

}

bool RecordUrlFilter::check(QString url)
{
    // 读取黑名单文件中的url进行检验
//    QVector<QString> urls();
    QFile file(":/safe_explore_resource/not_safe_url.txt");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
        qDebug() << "open file error";
        return true;
    }

    QTextStream in(&file);
    while (!in.atEnd()) {
        QString line = in.readLine();
        if(url.contains(line)){
            return false;
        }
    }
    return true;
}
